home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_15_1987_Transactor_Publishing.d64
/
cap meter
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
3KB
|
76 lines
1 rem *********************************
2 rem ** capacitance meter software **
3 rem ** name: cap **
4 rem ** (c) 1985, j.j. barbarello ** 5 rem ** manalapan, nj 07726 **
6 rem ** v 1.1, 11 nov 85 **
7 rem *********************************
10 gosub 440:print:r(0)=9.75:f(0)=19:r(1)=.00979:f(1)=2
20 data 120,169,0,141,1,221,169,2,141,1
30 data 221,162,2,160,0,169,1,45,1,221
40 data 240,15,232,234,234,234,234,234
50 data 224,0,208,239,200,192,0,208,234
60 data 142,0,193,140,1,193,88,96,999
70 a=49152:c=a:fori=1to16:sp$=sp$+" ":next
80 b1$=chr$(176)+"[195][195]"+chr$(174)
90 b2$=chr$(173)+"[195][195]"+chr$(189)
100 read b:if b<>999 then poke a,b:a=a+1:goto 100
110 gosub 620:poke 56579,254:poke 56577,6
120 col=10:ro=9:gosub670:print b1$:ro=10:gosub670:print"[194]f1[194]";
130 print b$;" _ low range":ro=11:gosub670:print b2$
140 ro=12:gosub670:print b1$:ro=13:gosub670:print"[194]f3[194]";b$;" _ high range"
150 ro=14:gosub670:print b2$:ro=15:gosub670:print b1$
160 ro=16:gosub670:print"[194]f5[194]";b$;" _ clear display":ro=17:gosub670:print b2$
170 ro=18:gosub670:print b1$:ro=19:gosub670:print"[194]f7[194]";b$;" _ off"
180 ro=20:gosub670:print b2$:goto 270
190 co=12:ro=5:gosub 670:print sp$
200 sys c:x=peek(49409)*256+peek(49408)
210 if ri=0 and x<f(0)+5 then x=0:goto 240
220 if x>1000 then 240
230 av=0:for i=1to10:sys c:x=peek(49409)*256+peek(49408):av=av+x:next:x=av/10
240 printchr$(159):if x<=f(ri) then x$="[157][157][157]out of range":x=0
250 co=18:row=5:gosub 670:x=(x-f(ri))/(43300*r(ri)):gosub510:print x$
260 ro=rr:co=11:gosub670:print fu$
270 get a$:if a$="" then 270
280 g=asc(a$):if g<133 or g>136 then 270
290 on g-132 goto 300,320,340,360
300 ro=10:co=11:gosub670:printchr$(18);"f1":rr=10:fu$="f1"
310 poke 49159,2:poke 56577,2:ri=0:fi=0:goto 190
320 ro=13:co=11:gosub670:printchr$(18);"f3":rr=13:fu$="f3"
330 poke 49159,6:poke 56577,6:ri=1:goto 190
340 gosub 400:goto 270
350 poke 49408,0:poke 49409,0:goto190
360 rem** end
370 printchr$(147):ro=12:co=10:gosub670
380 printchr$(18);" meter off ";chr$(146);" - program ended."
390 print:print:print:end
400 rem** clear display (f5 function)
410 ro=16:co=11:gosub 670:printchr$(18);"f5"
420 co=12:ro=5:gosub 670:print sp$:for i=1 to 200:next i
430 ro=16:co=11:gosub 670:print"f5":return
440 rem** format screen=
450 poke 53280,6:poke 53281,6:printchr$(147)
460 b$=chr$(30)+chr$(18):bl$=" "+b$+" ":printbl$
470 printtab(8);chr$(30)chr$(18)chr$(142);" c-64 capacitance meter "
480 printbl$:bb$=" "+b$+" "+chr$(146)+" "+b$+"[160][160]"
490 printbb$:printbb$:printbb$
500 fori=1to14:printbl$:next i:print bl$:return
510 rem ** format output
520 if x<=0 then return
530 p$=right$(str$(x),4):if asc(p$)<>69 then 580
540 p=val(right$(p$,2)):po=p+2
550 x$=str$(int(x*10^po+.5))
560 x$=right$(x$,len(x$)-1):if p=5 then x$=left$(x$,2)
565 if p$="e-03" then print ".00"x$" uf": return
570 x$=x$+" "+chr$(18)+"pf":return
580 p=1:if x<1 then p=1000:goto 610
590 if x<10 then p=100:goto 610
600 if x<100 then p=10
610 x=int(x*p+.5):x=x/p:x$=str$(x):x$=right$(x$,len(x$)-1)+" uf":return
620 rem* cursor control using plot kernel ($fff0)
630 data 162,0,160,0,24,32,240,255,96,999
640 a=49300:sc=a
650 read b:if b<>999 then poke a,b:a=a+1:goto 650
660 return
670 poke sc+3,col:poke sc+1,row:sys sc
680 return